checkout: don't apply SELinux labeling in user mode
authorJonathan Lebon <jlebon@redhat.com>
Fri, 2 Jun 2017 14:06:50 +0000 (10:06 -0400)
committerAtomic Bot <atomic-devel@projectatomic.io>
Fri, 2 Jun 2017 17:46:16 +0000 (17:46 +0000)
If the user requested a user checkout, we don't want to set the SELinux
label xattr.

Closes: #903
Approved by: cgwalters

src/libostree/ostree-repo-checkout.c

index 360c939f8541c72efed64e41bea8794411b93453..8dbe49e3a3bb69dbd0e3f5cbf84daecf4b997ecb 100644 (file)
@@ -261,14 +261,14 @@ create_file_copy_from_input_at (OstreeRepo     *repo,
                                         &tmpf, error))
         return FALSE;
 
-      if (sepolicy_enabled)
+      if (sepolicy_enabled && options->mode != OSTREE_REPO_CHECKOUT_MODE_USER)
         {
           g_autofree char *label = NULL;
-          if (!ostree_sepolicy_get_label (options->sepolicy,
-                                          state->selabel_path_buf->str,
+          if (!ostree_sepolicy_get_label (options->sepolicy, state->selabel_path_buf->str,
                                           g_file_info_get_attribute_uint32 (file_info, "unix::mode"),
                                           &label, cancellable, error))
             return FALSE;
+
           if (fsetxattr (tmpf.fd, "security.selinux", label, strlen (label), 0) < 0)
             return glnx_throw_errno_prefix (error, "Setting security.selinux");
         }